import Vue from 'vue'
import VueRouter from 'vue-router'
import index from '../views/index.vue'

Vue.use(VueRouter)

const routes = [{
    path: '/',
    redirect: "/index"
  },
  {
    path: '/index',
    name: 'index',
    meta: {
      title: '起点中文网-首页'
    },
    component: index
  }, { // 分类
    path: '/category',
    name: 'category',
    meta: {
      title: '起点中文网-分类'
    },
    component: () => import('../views/category')
  }, { // 排行
    path: '/rank',
    name: 'rank',
    meta: {
      title: '起点中文网-排行'
    },
    component: () => import('../views/rank')
  }, { // 免费
    path: '/free',
    name: 'free',
    meta: {
      title: '起点中文网-免费'
    },
    component: () => import('../views/free')
  }, { // 完本
    path: '/finished',
    name: 'finished',
    meta: {
      title: '起点中文网-完本'
    },
    component: () => import('../views/finished')
  }, { // 大神
    path: '/god',
    name: 'god',
    meta: {
      title: '起点中文网-大神'
    },
    component: () => import('../views/god')
  }, { // 搜索
    path: '/search',
    name: 'search',
    meta: {
      title: '起点中文网-搜索'
    },
    component: () => import('../views/search'),
  }, { // 小说详情
    path: '/details',
    name: 'details',
    component: () => import('../components/details')
  }, { // 阅读器
    path: '/reader',
    name: 'reader',
    component: () => import('../components/reader')
  }, { // 书架
    path: '/bookshelf',
    name: 'bookshelf',
    meta: {
      title: '起点中文网-书架'
    },
    component: () => import('../components/bookshelf')
  }, {
    // 分类下的列表
    path: '/category/list',
    meta: {
      title: '起点中文网-分类'
    },
    component: () => import('../components/category/list')
  }, {
    // 排行下的列表
    path: '/rank/list',
    meta: {
      title: '起点中文网-排行榜'
    },
    component: () => import('../components/rank/list')
  }, {
    // 更多内容列表
    path: '/morelist',
    meta: {
      title: '起点中文网-更多内容'
    },
    component: () => import('../components/moreList')
  }, {
    // 作者详情
    path: '/author',
    name: 'author',
    meta: {
      title: '起点中文网-作者详情'
    },
    component: () => import('../components/author')
  }, {
    // 用户中心
    path: '/user',
    name: 'user',
    meta: {
      title: '个人中心-起点中文网'
    },
    component: () => import('../views/user')
  }

]

const router = new VueRouter({
  // mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router